using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace A_stain_on_the_planet
{
    class OlieVlek
    {
        Vector2 m_Position;
        Vector2 m_Velocity;
        Texture2D m_texture;
        BoundingBox m_Box;
        int m_FrameRateX;
        int m_FrameRateY;
        int m_FrameTeller;
        int m_width;
        int m_height;

        public OlieVlek(Vector2 Position, Vector2 velocity, Texture2D tex, int width, int height)
        {
            m_Position = Position;
            m_Velocity = velocity;
            m_texture = tex;
            m_width = width;
            m_height = height;

        }

        public void update()
        {
            m_Position += m_Velocity/7;

            ++m_FrameTeller;

            if (m_FrameTeller >= 5)
            {
                ++m_FrameRateX;

                if (m_FrameRateX >= 7)
                {
                    ++m_FrameRateY;
                    m_FrameRateX = 0;

                    if (m_FrameRateY >= 2) m_FrameRateY = 0;
                }


                m_FrameTeller = 0;
            }

            m_Box.Min.X = m_Position.X + 30;
            m_Box.Max.X = m_Position.X + m_width - 30;

            m_Box.Min.Y = m_Position.Y + 30;
            m_Box.Max.Y = m_Position.Y + m_height - 30;
        }

        public void draw(SpriteBatch sprite)
        {
            sprite.Draw(m_texture, new Rectangle((int)m_Position.X, (int)m_Position.Y, m_width, m_height), new Rectangle(144 * m_FrameRateY, 114 * m_FrameRateX, 144, 114), Color.White);
        }

        public Vector2 position
        {
            get { return m_Position; }
            set { m_Position = value; }
        }

        public BoundingBox ColisionBox
        {
            get { return m_Box; }
            set { m_Box = value; }
        }
    }
}
